package com.pesking.core.sqlparser.processor;

import java.util.Arrays;
import java.util.List;

import com.pesking.core.model.ModelManage;
import com.pesking.core.parameter.Parameter;
import com.pesking.core.sqlparser.parameter.SqlParameter;
import com.pesking.core.sqlparser.parameter.SqlParameterProcessor;

public class ModelConfigSqlParameterProcessor extends SqlParameterProcessor {
	@Override
	public String getTitle() {
		return "模块配置参数";
	}

	@Override
	public String getDescription() {
		return null;
	}

	@Override
	public List<String> getSqlParameterType() {
		return Arrays.asList(new String []{"MC"});
	}

	@Override
	public void handle(StringBuilder sbSQL, Parameter parameter, List<SqlParameter> processors,
			SqlParameter sqlParameter) {
		String name = sqlParameter.getName();
		String defaultValue = sqlParameter.getValue();
		String value = ModelManage.getSingleParameter(name, defaultValue);
		if (value == null) {
			value = "";
		}
		sbSQL.append(value);
	}

}
